import QtQuick
import QtQuick.Controls

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("可编辑的ComboBox")

    ComboBox {
        anchors.centerIn: parent
        width: 200
        height: 40
        editable: true
        id: cbox
        model: ["100", "1000", "10000"]

        validator: RegularExpressionValidator {
            regularExpression: /^[A-Za-z0-9_]+$/
        }

        onAccepted: {
            if (find(editText) === -1) {
                model = model.concat(editText)
            }
        }
    }
}
